package com.googlecode.moneyManager.excelReader;

import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Repository;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * Author: Sergiy Doroshenko
 * Date: Jul 19, 2010
 * Time: 4:41:04 PM
 */
@Repository
public class ExcelDocument {
    private Resource excelResource;    
    private XSSFWorkbook wb;
    public ExcelDocument(Resource excelResource) throws IOException{
        this.excelResource = excelResource;
        this.wb =  new XSSFWorkbook(excelResource.getInputStream());
    }

    public XSSFSheet getSheet(int page){
        XSSFSheet sheet = wb.getSheetAt(page);

        return sheet;
    }
}
